::@echo off

call zzz_killJar.bat

:: 项目路径
set projectPath=D:\Projects\8084-cadre-evaluation
:: 项目名字
set projectName=cadre-evaluation
:: jenkins拷过来的文件的名字
set projectSource=cadre-evaluation-1.0

::备份jar文件到jarOld
copy %projectPath%\%projectName%.jar %projectPath%\jarOld\
::按日期重命名
set str=%projectName%_%Date:~0,4%%Date:~5,2%%Date:~8,2%%Time:~0,2%%Time:~3,2%%Time:~6,2%
set str2=%str: =%

ren %projectPath%\jarOld\%projectName%.jar %str2%.jar
::删除
del %projectPath%\%projectName%.jar

::超过2天的文件就删除
forfiles -p "%projectPath%\jarOld" -s -m "*.jar" -d -2 -c "cmd /c del @FILE"

::从sftproot里拷贝传输的jar
copy C:\"Program Files"\nsoftware\"PowerShell Server 2016"\sftproot\%projectSource%.jar %projectPath%
::重命名
ren %projectSource%.jar %projectName%.jar

:: 删除 jenkins拷过来的文件
del C:\"Program Files"\nsoftware\"PowerShell Server 2016"\sftproot\%projectSource%.jar
